$("#submission").click(function () {
    var id = parent.$("#id").val();
    var mark = $("#mark").val();
    if (mark == "" || mark == null) {
        alert("标签不能为空！");
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/caseSelection/addMark",
        type: "post",
        data: {
            "id": id,
            "mark": mark
        },
        success: function (data) {
            Feng.success("提交成功!");
            window.parent.parent.CaseSelection.search();
            window.parent.$("#mark").val(mark);
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
});

$.ajax({
    url: Feng.ctxPath + "/caseSelection/getMarkList",
    type: "post",
    success: function (data) {
        var li = "";
        for (var i = 0; i < data.length; i++) {
            li += '<li id="' + data[i].customMark + '" style="position: relative"><a href="javascript:;">' + data[i].customMark + '</a><span class="glyphicon glyphicon-remove" style="position: absolute;top: 50%;right: 10px;transform: translateY(-50%)"></span></li>'
        }
        $("#dropdownMenu2Ul").html(li)
    },
    error: function (data) {
        alert('没有权限，请联系管理员!');
    }
});

$("#dropdownMenu2Ul").on('click', 'li', function () {
    var value = $(this).attr('id')
    $("#mark").val($("#mark").val()+" "+value);
});

function addMark() {
    var index = layer.open({
        type: 2,
        title: '&nbsp',
        area: ['40%', '40%'],
        fix: true,
        maxmin: true,
        content: Feng.ctxPath + '/caseSelection/to_mark_label/'
    });
    this.layerIndex = index;
}